<template>
<div style="height: 100%;display: flex">
  <div class="login-container">
    <h2>登录</h2>
   <el-form>
     <el-form-item label="用户名" label-width="80px"><el-input style="width: 200px" v-model="data.username"></el-input></el-form-item>
     <el-form-item label="密码" label-width="80px"><el-input style="width: 200px" v-model="data.password" show-password></el-input></el-form-item>
     <div>
       <el-button type="primary" @click="login">登录</el-button>
     </div>
   </el-form>
  </div>
</div>
</template>

<script>
import {login} from "@/api";
// import {config} from "@/config";

export default {
  name: "login",
  data(){
    return {
      data:{
        username:"",
        password:"",
      },
      password_compare:""

    }
  },
  mounted() {

  },
  methods:{
    login(){
        let form = new FormData()
        form.set("username",this.data.username)
        form.set("password",this.data.password)
      login(form).then(res=>{
          console.log(res.data)
        if(res.data.code===200){
            this.$router.push("/")
        }
      })
    }

  }

}
</script>

<style scoped>
.login-container{
  width: 400px;
  padding: 20px;
  margin: auto auto;
  box-shadow: 0px 1px 5px 0px #2c3e50;
  vertical-align: middle;
}
</style>